package org.xczy.payment.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.xczy.payment.service.PaymentService;
import org.xczy.payment.mapper.PaymentMapper;
import org.springframework.stereotype.Service;
import org.xczy.service.model.entitys.pojo.Payment;

import javax.annotation.Resource;
import java.util.List;

/**
* @author Administrator
* @description 针对表【payment(支付表)】的数据库操作Service实现
* @createDate 2023-06-04 15:13:33
*/
@Service
public class PaymentServiceImpl extends ServiceImpl<PaymentMapper, Payment> implements PaymentService{
  @Resource
  private PaymentMapper paymentMapper;

  @Override
  public int addPayment(Payment payment) {
    return paymentMapper.insert(payment);
  }

  @Override
  public int deletePayment(Long id) {
    return paymentMapper.deleteById(id);
  }

  @Override
  public int editPayment(Payment payment) {
    return paymentMapper.updateById(payment);
  }

  @Override
  public List<Payment> getPayment() {
    return paymentMapper.selectList(null);
  }

  @Override
  public Payment getPayment(Long id) {
    LambdaQueryWrapper<Payment> wrapper = new LambdaQueryWrapper<>();
    wrapper.eq(Payment::getId, id);
    return paymentMapper.selectOne(wrapper);
  }
}




